﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

public partial class Index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btOK_Click(object sender, EventArgs e)
    {
        using (DataClassesDataContext dataContext = new DataClassesDataContext())
        {
            css_yhxx dUser = dataContext.css_yhxx.FirstOrDefault(o => o.yhbh == CMSUser.Current.ID && o.yhmm == tbPassword.Text.Trim());
            if (dUser != null)
            {
                if (tbPassword1.Text.Equals(tbPassword2.Text))
                {
                    dUser.yhmm = tbPassword2.Text;
                    dataContext.SubmitChanges();
                    Frame.Global.GlobalFunctions.Alert("密码修改成功!");
                }
                else
                {
                    Frame.Global.GlobalFunctions.Alert("新密码两次输入不一致!");
                }
            }
            else
            {
                Frame.Global.GlobalFunctions.Alert("旧密码错误!");
            }
        }
    }
}